Page layout is the art of positioning elements, such as text and graphics, on a page with the aim of creating a desired aesthetic effect for a document. Whilst this may be done manually, modern approaches involve representing the elements and the page electronically in a computer system whereupon the page may be subsequently reproduced, perhaps on a video display device but typically the page targeted for reproduction by printing.
In order to realise a certain aesthetic effect, the document author will want to retain control over most aspects of page layout. However, there are some circumstances under which a certain degree of automated layout, within specified constraints, is of great benefit.
Variable Data Printing, or VDP, is an example of a class of software applications that benefit from constraint-based automatic layout. VDP allows for the printing of a large number of documents, each of which contains text and graphics that have been customised to the document's recipient by inclusion of so-called variable text and graphics.
A VDP document is typically formed from a template containing static text and graphic objects. The document author then adds placeholders to the template. The placeholders define how elements, such as variable text and graphic objects, are to be selected and laid out within the document to be produced.
A container defines an area on a page that can hold display content, such as images, text, or other media elements. Containers have a size and position that can be fixed on the page, or which can be varied by negotiating for space with other containers. A container's bounds are not necessarily confined to the printable area of the page. A straight line segment of the border of a container is referred to as an edge.
An edge can either be either fixed or movable. A fixed edge has a constant absolute position on the page. A movable edge has a position that can change according to certain placed elements and the rules of one or more of the containers.
Multiple graphical and text elements may be used in the layout. These elements may vary in size and proportion. Without constraint-based automatic layout, each element would be assigned to a container with fixed edges. However, this inflexible approach can lead to an inappropriate amount of space being allocated in many instances.
For example, two adjacent containers of the same size could be occupied by images with greatly differing sizes, leading to the larger image being scaled down and the smaller image failing to fill its space. This can also lead to undesired space around and between elements, due to the actual element differing in aspect ratio from the allocated container. Better results may be obtained if the neighbouring containers can negotiate between each other to determine the best area to allocate to each container. Such negotiation is typically carried out by an automatic layout process using the constraints and the element properties.
There are other (non-VDP) applications which nevertheless are template based. Templates are very good at defining precise layouts, into which content may be inserted. However, it is desirable to define a template which defines a general appearance, but allows the flexible use of different numbers and size of elements. This allows multiple documents to be produced with a similar appearance from a single template. It can also free the document author from some tedious aspects of manually balancing elements against each other.
It is therefore desirable to have a mechanism to set constraints to allow containers to negotiate with each other to determine the size of each container.
Previous solutions have involved the addition of some kind of visual connection between containers to constrain them. As an example, some previous solutions have employed the use of a device called a “strut”. Struts may either be explicitly added to the template by the user, or automatically added by the application. Struts operate to constrain two container edges to the same relative distance apart, regardless of their absolute position on the page.
Struts, and other visual devices for associating and constraining pairs of containers, add visual clutter to the layout, and are limited to each constraining a single pair of edges. In addition, edges have to be manually set to be movable or fixed. This means that the outer boundary has to explicitly be constrained. For example, consider a container on a page with one edge set to be movable. Unless the edge movement is limited by a maximum size setting on the container, or an explicit border placed on the page, this edge can move without limit, even extending beyond the printable area of the page.